package com.kaishengit.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.kaishengit.pojo.SalesBack;
import com.kaishengit.service.SalesBackService;

@Controller
public class SalesBackController {
	private SalesBackService salesBackService;
	
	@RequestMapping("/salesBackList")
	public String findAll(Model model){
		List<SalesBack> salesBackList = salesBackService.findAll();
		model.addAttribute("salesBackList", salesBackList);
		return "salesBackList";
	}
	@RequestMapping("/salesBacklist")
	public String findByWhere(Model model,SalesBack salesBack){
		List<SalesBack> salesBackList = salesBackService.findByWhere(salesBack);
		model.addAttribute("salesBackList", salesBackList);
		return "salesBackList";
	}
	@RequestMapping("/addSalesBack")
	public String add(SalesBack salesBack){
		salesBackService.add(salesBack);
		return "redirect:/salesBack";
	}

	@Autowired
	public void setSalesBackService(SalesBackService salesBackService) {
		this.salesBackService = salesBackService;
	}
	
	

}
